package com.wutong.erb.exception.base;

import java.util.HashMap;
import java.util.Map;

/**
 * 基础异常类
 * @author wutong
 */
public class BaseException extends RuntimeException {

    private static final Map<Long, Map<Integer, ? extends BaseException>> EXCEPTION_MAP = new HashMap<>();

    public BaseException(Long exceptionId, Map<Integer, ? extends BaseException> exceptionMap, String message) {
        super(message);
        if (!EXCEPTION_MAP.containsKey(exceptionId)) {
            EXCEPTION_MAP.put(exceptionId, exceptionMap);
        } else {
            throw new IllegalArgumentException("ExceptionId 早已存在于异常映射表中，请检查！");
        }
    }
}
